package com.bom.core.util.convert;

import lombok.experimental.UtilityClass;

import java.util.function.BiFunction;
import java.util.function.Function;

@UtilityClass
public class Convertors {
    /**
     * 转换器
     */
    public <A, B> B convert(A value, Function<A, B> function) {
        return function.apply(value);
    }

    /**
     * 环境变量的转换器
     */
    public <A, B, R> B convert(R root, A value, BiFunction<R, A, B> function) {
        return function.apply(root, value);
    }
}
